package com.mc.service.did.impl;

import java.util.concurrent.atomic.AtomicLong;
import lombok.ToString;

/**
 * 号段基础类
 */
@ToString
public class Segment {

	private final long start;

	private final long end;

	private final AtomicLong current;

	public Segment(long start, long end) {
		this.start = start;
		this.end = end;
		this.current = new AtomicLong(start);
	}

	public long next() {
		return current.getAndIncrement();
	}

	public long getEnd() {
		return end;
	}

	public long getStart() {
		return start;
	}

}
